package com.example.springboot09.danlimoshi;

/**
 * @ClassName LazyMan1
 * @Description TODO
 * @Author tianqinglong
 * @Date 15:37 2022/7/25
 * @Version 1.0
 **/
public class LazyMan1 {
    public static void main(String[] args) {
        getInstance();
    }
    private LazyMan1(){
        System.out.println(1);
    }
    public volatile static LazyMan1 lazyMan1;

    public static LazyMan1 getInstance(){
        if (lazyMan1==null){
            synchronized (LazyMan1.class){
             if (lazyMan1==null){
                 lazyMan1=new LazyMan1();
             }
            }
        }
        return lazyMan1;
    }
}
